<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_sys_class('model', '', 0);
class company_model extends model {
	function __construct() {
		$this->db_config = pc_base::load_config('database');
		$this->db_setting = 'default';
		$this->table_name = 'member_company';
		$this->_username = param::get_cookie('_username');
		$this->_userid = param::get_cookie('_userid');
		parent::__construct();
	}
	//公司列表页
	function list_company($condition, $offset, $pagesize){
		$sql = 'select * from '.$this->table_name.' where '.$condition;
		
		$sql_count = 'select count(companyid) as num from '.$this->table_name.' where '.$condition;
		$sql .= " LIMIT $offset,$pagesize";
		$this->query($sql);
		$return = $this->fetch_array();
		$this->query($sql_count);
		$total = $this->fetch_array();
		$total = $total[0]['num'];
		return array('data'=>$return,'total'=>$total);
	}
	
	
}
?>